1. Field of the Invention
This invention relates generally to the processing of instructions for a digital computer system. More specifically, it relates to performing shift, mask, and merge operations on operands in a single instruction.
2. Background Information
Shifting is the process of moving data that is stored in a storage device relative to the boundaries of the device, as opposed to moving data in or out of the device. The storage device is usually a register and the direction of the shift is either left or right. In a circular shift, the bit shifted out of one end of the register is shifted into the other end. Thus, there is no loss of information for a circular shift. Shift operations are usually used in field alignments, packing and unpacking of data items into storage units, and high-speed multiplication and division.
Masking is used when items of information required by a computer program may be of lengths that are not matched to the usually fixed length of the storage unit in memory. If several items are packed into one unit, a mechanism is necessary to retrieve the item needed without interference from other items that are stored in the same storage unit. Masking is the procedure whereby the desired information is extracted from the storage unit while suppressing the undesired information.
Merging involves combining two distinct sets of data in a particular fashion into one set of data. It constructs the union of the two sets if all members of the sets are to be combined. The intersection of the two sets may also be formed if selected members of the two sets are to be discarded when constructing the resultant set.
Logic to perform shift, mask, and merge operations on data have been well known in the computer industry for many years. The instruction set architecture of a general purpose digital computer system typically includes various instructions to perform such logical operations. Each logical operation is usually implemented in one instruction. Thus, a computer programmer wanting to use a combination of these logical operations to manipulate a given set of data must code a series of instructions to obtain the desired result. This method provides the programmer with control over the order of execution and selection of operands for the logical operations. However, the drawback is that multiple instructions are required. Each instruction fetched and decoded by the processor takes processing time and uses space in the instruction control store. Using multiple instructions to perform a sequence of logical operations thus incurs a performance penalty. What is needed is a mechanism by which a computer programmer can control the manipulation of data in two operands according to common logical operations without the need to fetch and decode an instruction for each logical operation. Furthermore, a desirable capability is to be able to select one of the operands for shifting and masking, before merging it with the second operand.
Various patents in the prior art and describe instructions and show circuits which perform these individual logical operations, but none provide the speed and flexibility of the present invention. U.S. Pat. No. 3,906,459, to Desmonds, et. al., shows a binary data manipulator with shift, mask, and merge components. However, the operations supported are mutually exclusive per instruction cycle and are designed to be performed in a pipeline fashion. U.S. Pat. No. 3,982,229, to Rouse, et. al., shows a combinational logic arrangement for performing shift, rotate, and mask operations in parallel, followed by a merge operation. But, the output of the shift cannot be cascaded as input into the mask operation, as in the present invention. U.S. Pat. No. 4,139,899, to Tulpule, et. al., and U.S. Pat. No. 4,556,978, to Kregness, et. al., show systems for shifting and masking, but with no control over a merging operation. U.S. Pat. No. 4,569,016, to Hao, et. al., discloses a RISC-based system for shifting, masking, and merging operands. The present invention provides greater flexibility in specifying operands and operations for shifting, masking, and merging data in a single cycle.